<script>
function update_slider_to_inputs(id,values)
{
	if (!values) {
		var sl=$(".slider_"+id);
		values=[sl.slider("values",0),sl.slider("values",1)];
	}
	$("input[name='"+id+"_min']").attr("value",values[0]);
	$("input[name='"+id+"_max']").attr("value",values[1]);
}
</script>

<div class="market-catalog1-list">
<div class="nav">
	<div class="categories">
	{{foreach cat in market_categories}}
		<div class="category category-{{cat.level}}{{if cat.active}} category-A category-A-{{cat.level}}{{/if}}">
			<a class="name" href="{{action}}cat/{{cat.calc_code}}/">{{cat.name}}</a>
		</div>
	{{/foreach}}
	</div>
	<div class="searchform">
	<form action="{{action}}" name="catsearch" method="GET">
	<input type="hidden" name="mcatid" value="{{fields.mcatid}}"/>
	<div class="item item-range">
		<div class="name">{{!search_price}}</div>
		<div class="inputs"><input type="text" name="price_min" value="" size="8"/> - <input type="text" name="price_max" value="" size="8"/></div>
		<div class="range-slider"><div class="slider_price"></div></div>
<script>
$(".slider_price").slider({
	range: true,
	min: {{search_market_price.min}},
	max: {{search_market_price.max}},
	values: [ {{search_market_price.cmin}}, {{search_market_price.cmax}} ],
	slide: function( event, ui ) { update_slider_to_inputs("price",ui.values);}
});
update_slider_to_inputs("price");
</script>

	</div>
	<div class="item item-cb">
		<div class="name">{{!search_vendor}}</div>
		<div class="values">
			{{foreach vendor in search_market_vendors}}
			<div class="cb"><input type="checkbox" name="vnd" value="{{vendor.id}}"{{if vendor.active}} checked="yes"{{/if}}/> {{vendor.name}}</div>
			{{/foreach}}
			<div style="clear: both;"></div>
		</div>
	</div>
	{{foreach param in search_market_params}}
	<div class="item item-{{param.code}}">
		<div class="name">{{param.name}}</div>
		<div class="values">
		{{if param.code=="cb"}}
			{{foreach i in param.values}}
			<div class="cb"><input type="checkbox" name="par_{{param.id}}" value="{{i.id}}"{{if i.active}} checked="yes"{{/if}}/> {{i.value}}</div>
			{{/foreach}}
			<div style="clear: both;"></div>
		{{/if}}
		{{if param.code=="range"}}
			<div class="inputs"><input type="text" name="par_{{param.id}}_min" value="" size="8"/> - <input type="text" name="par_{{param.id}}_max" value="" size="8"/></div>
			<div class="range-slider"><div class="slider_par_{{param.id}}"></div></div>
<script>
$(".slider_par_{{param.id}}").slider({
	range: true,
	min: {{param.min}},
	max: {{param.max}},
	values: [ {{param.cmin}}, {{param.cmax}} ],
	slide: function( event, ui ) { update_slider_to_inputs("par_{{param.id}}",ui.values);}
});
update_slider_to_inputs("par_{{param.id}}");
</script>
		{{/if}}
		</div>
	</div>
	{{/foreach}}
	<div class="submit"><input type="submit" value="{{!search_submit}}"/></div>
	</form>
	</div>
</div>
<div class="other">
	<div class="items">
	{{foreach item in market_items}}{{include "widgets/market_catalog1/list_item"}}{{/foreach}}
	</div>
	<div style="clear: both;"></div>
</div>
<div style="clear: both;"></div>
</div>

